package com.trkj.pojo;

import java.io.Serializable;
import javax.persistence.*;

import com.alibaba.fastjson.annotation.JSONField;

import java.util.List;


/**
 * The persistent class for the FUNCTION_TYPE database table.
 * 
 */
@Entity
@Table(name="FUNCTION_TYPE")
@NamedQuery(name="FunctionType.findAll", query="SELECT f FROM FunctionType f")
public class FunctionType implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="FUNCTION_TYPE_FUNCTIONID_GENERATOR", sequenceName="HR")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="FUNCTION_TYPE_FUNCTIONID_GENERATOR")
	@Column(name="FUNCTION_ID")
	private long functionId;

	@Column(name="FUNCTION_NAME")
	private String functionName;

	//bi-directional many-to-one association to Function
	@OneToMany(mappedBy="functionType")
	@JSONField(serialize=false)
	private List<Function> functions;

	public FunctionType() {
	}

	public long getFunctionId() {
		return this.functionId;
	}

	public void setFunctionId(long functionId) {
		this.functionId = functionId;
	}

	public String getFunctionName() {
		return this.functionName;
	}

	public void setFunctionName(String functionName) {
		this.functionName = functionName;
	}

	public List<Function> getFunctions() {
		return this.functions;
	}

	public void setFunctions(List<Function> functions) {
		this.functions = functions;
	}

	public Function addFunction(Function function) {
		getFunctions().add(function);
		function.setFunctionType(this);

		return function;
	}

	public Function removeFunction(Function function) {
		getFunctions().remove(function);
		function.setFunctionType(null);

		return function;
	}

}